#include <iostream>
#include "majestic.h"
bool Majestic::Screen::getstart()
{
    sf::Event Event;
    while (App.PollEvent(Event))
    {
    if (Event.Key.Code == sf::Keyboard::Return)
        return true;
    }
}
int Majestic::Screen::getstate()
{
    int returntmp=-1;
    if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Up))   returntmp= 1;
    if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Down)) returntmp= 2;
    if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Left)) returntmp= 3;
    if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Right)) returntmp= 4;
    if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Up)&&sf::Keyboard::IsKeyPressed(sf::Keyboard::Left))   returntmp= 103;
    if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Up)&&sf::Keyboard::IsKeyPressed(sf::Keyboard::Right))   returntmp= 104;
    if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Down)&&sf::Keyboard::IsKeyPressed(sf::Keyboard::Left))   returntmp= 203;
    if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Down)&&sf::Keyboard::IsKeyPressed(sf::Keyboard::Right))   returntmp= 204;
    return returntmp;
}
Majestic::Screen::mouse Majestic::Screen::getmouse()
{
    sf::Event Event;
    App.PollEvent(Event);
    Majestic::Screen::mouse returnstruct;
    returnstruct.button = -1;
    if (Event.Type==sf::Event::MouseButtonPressed)
    {
        returnstruct.button = Event.MouseButton.Button;
        returnstruct.x = Event.MouseButton.X;
        returnstruct.y = Event.MouseButton.Y;
    }
    return returnstruct;
}
int Majestic::Screen::getkey()
{
   int returntmp=-1;
   sf::Event Event;
    App.PollEvent(Event);
    if (Event.Type==sf::Event::Closed) returntmp= 0;
    switch(Event.Key.Code)
    {
            case sf::Keyboard::A:
            {returntmp= 5;break;}
            case sf::Keyboard::B:
            {returntmp= 6;break;}
            case sf::Keyboard::C:
            {returntmp= 7;break;}
            case sf::Keyboard::D:
            {returntmp= 8;break;}
            case sf::Keyboard::E:
            {returntmp= 9;break;}
            case sf::Keyboard::F:
            {returntmp= 10;break;}
            case sf::Keyboard::G:
            {returntmp= 11;break;}
            case sf::Keyboard::H:
            {returntmp= 12;break;}
            case sf::Keyboard::I:
            {returntmp= 13;break;}
            case sf::Keyboard::J:
            {returntmp= 14;break;}
            case sf::Keyboard::K:
            {returntmp= 15;break;}
            case sf::Keyboard::L:
            {returntmp= 17;break;}
            case sf::Keyboard::M:
            {returntmp= 18;break;}
            case sf::Keyboard::N:
            {returntmp= 19;break;}
            case sf::Keyboard::O:
            {returntmp= 20;break;}
            case sf::Keyboard::P:
            {returntmp= 21;break;}
            case sf::Keyboard::Q:
            {returntmp= 22;break;}
            case sf::Keyboard::R:
            {returntmp= 23;break;}
            case sf::Keyboard::S:
            {returntmp= 24;break;}
            case sf::Keyboard::T:
            {returntmp= 25;break;}
            case sf::Keyboard::U:
            {returntmp= 26;break;}
            case sf::Keyboard::V:
            {returntmp= 27;break;}
            case sf::Keyboard::W:
            {returntmp= 28;break;}
            case sf::Keyboard::X:
            {returntmp= 29;break;}
            case sf::Keyboard::Y:
            {returntmp= 30;break;}
            case sf::Keyboard::Z:
            {returntmp= 31;break;}
            case sf::Keyboard::Num1:
            {returntmp= 32;break;}
            case sf::Keyboard::Num2:
            {returntmp= 33;break;}
            case sf::Keyboard::Num3:
            {returntmp= 34;break;}
            case sf::Keyboard::Num4:
            {returntmp= 35;break;}
            case sf::Keyboard::Num5:
            {returntmp= 36;break;}
            case sf::Keyboard::Num6:
            {returntmp= 37;break;}
            case sf::Keyboard::Num7:
            {returntmp= 38;break;}
            case sf::Keyboard::Num8:
            {returntmp= 39;break;}
            case sf::Keyboard::Num9:
            {returntmp= 40;break;}
            case sf::Keyboard::Num0:
            {returntmp= 41;break;}
            default:
            break;
    }


    return returntmp;
}




